﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>搜索选择</title>
    <link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../Comm/Gener.js" type="text/javascript"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <base target="_self" />
    <script src="../../Admin.js"></script>
    <script type="text/javascript">

        //页面启动函数.
        $(function () {

            //组织主键.
            var mypk = "MultipleChoiceSearch_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");

            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = mypk;
            var i = en.RetrieveFromDBSources();

            GenerFullAllCtrlsVal(en);

            if (i == 0)
                $("#Btn_Delete").attr("disabled", true);
            else
                $("#Btn_Delete").removeAttr("disabled");

            //去掉 ' 号。
            var tag = en.Doc;
            while (tag.indexOf('~') > 1) {
                tag = tag.replace("~", "'");
            }

            //按照文本计算.
            $("#TB_Doc").val(tag);

        });

        //执行保存
        function Save() {

            //组织主键.
            var mypk = "MultipleChoiceSearch_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = mypk;
            en.RetrieveFromDBSources();

            en.CopyForm(); //复制表单数据.

            en.FK_MapData = GetQueryString("FK_MapData");
            en.AttrOfOper = GetQueryString("KeyOfEn");
            en.ExtType = "MultipleChoiceSearch";

            en.MyPK = mypk;

            if (en.Update() == 0)
                en.Insert();

            SetHref("MultipleChoiceSearch.htm?FK_MapData=" + GetQueryString("FK_MapData") + "&KeyOfEn=" + GetQueryString("KeyOfEn") + "&M=" + Math.random());
            return;
        }

        //删除.
        function Delete() {

            if (window.confirm('您确定要删除吗？') == false)
                return;

            var mypk = "MultipleChoiceSearch_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = mypk;
            en.RetrieveFromDBSources();
            var i = en.Delete();

            var url = "MultipleChoiceSearch.htm?FK_MapData=" + GetQueryString("FK_MapData") + "&KeyOfEn=" + GetQueryString("KeyOfEn") + "&M=" + Math.random();
            SetHref(url);
        }
    </script>
</head>
<body>
    <div class="container-full">
        <div class="attrnode-bar-header">
            <span class="pull-right">
                <input type="button" value="保存" id="Btn_Save" class="cc-btn-tab" onclick="Save()" />
                <input type="button" value="删除" id="Btn_Delete" class="cc-btn-tab" onclick="Delete()" />
                <input type="button" value="帮助" id="Btn_Help" class="cc-btn-tab" onclick="ShowHidden('help')" />
            </span>
            <strong> 文本框搜索多选/单选</strong>
        </div>
        <form id="cc">

            <table class="table">

                <tr>
                    <td>

                        <a href="javascript:ShowHidden('SearchTip')">搜索提示</a>
                        <div id="SearchTip" style="color:Gray; display:none">
                            <ul>
                                <li>显示在搜索文本框的背景文字.</li>
                                <li>输入城市名称,比如:beijing,bj,进行搜索.</li>
                                <li>人员的编号,名称,拼音,进行模糊搜索.</li>
                            </ul>
                        </div>

                    </td>
                    <td colspan="3"><input type="text" value="请输入编号、拼音、关键字." placeholder="请输入编号、拼音、关键字." id="TBPara_SearchTip" name="TBPara_SearchTip" style="width:90%;" /> </td>
                </tr>

                <tr>
                    <td>数据源类型 </td>
                    <td>

                        <select id="DDL_DBType" name="DDL_DBType">
                            <option value="0">执行SQL</option>
                            <option value="1">执行url返回JSON</option>
                            <option value="2">执行CCFromRef.js返回JSON</option>
                        </select>
                    </td>
                    <td>选择类型</td>
                    <td>
                        <input type="radio" id="RBPara_SelectType_0" name="RBPara_SelectType" value="0" />
                        <label for="RBPara_SelectType_0">
                            单选
                        </label>
                        <input type="radio" id="RBPara_SelectType_1" name="RBPara_SelectType" checked="checked" value="1" />
                        <label for="RBPara_SelectType_1">
                            多选
                        </label>
                    </td>

                </tr>


                <tr>
                    <td colspan="4">数据源</td>
                </tr>

                <tr>
                    <td colspan=4>
<textarea rows="3" id="TB_Doc" name="TB_Doc" style="width:90%;"></textarea>
                    </td>
                </tr>
            </table>

            <fieldset>
                <legend>设置帮助</legend>
                <ul>
                    <li>SQL格式为:</li>
                    <li>SELECT No,Name FROM Port_Emp WHERE PinYin LIKE '@Key%' OR No LIKE '%@Key%' OR Name LIKE '%@Key%' </li>
                    <li>SELECT No,Name FROM CN_City WHERE PinYin LIKE '%@Key%' OR Name LIKE '%@Key%'</li>
                    <li>URL格式为:</li>
                    <li>/DataUser/Handler.ashx?xxx=sss </li>
                    <li>方法的格式为:</li>
                    <li>MyFunName</li>
                </ul>

                <legend>运行效果</legend>
                <ul>
                    <li> 适用于数据量比较大，内容比较多。 </li>
                    <li> 需要搜索到要选择的内容，然后放入到文本框里去。 </li>
                </ul>
                <img src="MultipleChoiceSearch.png" class="HelpImg" />
            </fieldset>

        </form>

    </div>

</body>
</html>
